package com.campus.manage.service.impl;

import java.util.List;
import com.campus.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.campus.manage.mapper.ClubAnnounceMapper;
import com.campus.manage.domain.ClubAnnounce;
import com.campus.manage.service.IClubAnnounceService;

/**
 * 公告Service业务层处理
 * 
 * @author hehe
 * @date 2025-10-22
 */
@Service
public class ClubAnnounceServiceImpl implements IClubAnnounceService 
{
    @Autowired
    private ClubAnnounceMapper clubAnnounceMapper;

    /**
     * 查询公告
     * 
     * @param announceId 公告主键
     * @return 公告
     */
    @Override
    public ClubAnnounce selectClubAnnounceByAnnounceId(Long announceId)
    {
        return clubAnnounceMapper.selectClubAnnounceByAnnounceId(announceId);
    }

    /**
     * 查询公告列表
     * 
     * @param clubAnnounce 公告
     * @return 公告
     */
    @Override
    public List<ClubAnnounce> selectClubAnnounceList(ClubAnnounce clubAnnounce)
    {
        return clubAnnounceMapper.selectClubAnnounceList(clubAnnounce);
    }

    /**
     * 新增公告
     * 
     * @param clubAnnounce 公告
     * @return 结果
     */
    @Override
    public int insertClubAnnounce(ClubAnnounce clubAnnounce)
    {
        clubAnnounce.setCreateTime(DateUtils.getNowDate());
        return clubAnnounceMapper.insertClubAnnounce(clubAnnounce);
    }

    /**
     * 修改公告
     * 
     * @param clubAnnounce 公告
     * @return 结果
     */
    @Override
    public int updateClubAnnounce(ClubAnnounce clubAnnounce)
    {
        clubAnnounce.setUpdateTime(DateUtils.getNowDate());
        return clubAnnounceMapper.updateClubAnnounce(clubAnnounce);
    }

    /**
     * 批量删除公告
     * 
     * @param announceIds 需要删除的公告主键
     * @return 结果
     */
    @Override
    public int deleteClubAnnounceByAnnounceIds(Long[] announceIds)
    {
        return clubAnnounceMapper.deleteClubAnnounceByAnnounceIds(announceIds);
    }

    /**
     * 删除公告信息
     * 
     * @param announceId 公告主键
     * @return 结果
     */
    @Override
    public int deleteClubAnnounceByAnnounceId(Long announceId)
    {
        return clubAnnounceMapper.deleteClubAnnounceByAnnounceId(announceId);
    }
}
